<!-- 现货金字塔 -->
<template>
	<view class="content">

		<u-form :model="form" ref="uForm">
			<!-- 通用头部 start -->
			<view class="form-line">

				<u-form-item label-width="130rpx">
					<u-input v-model="form.market" type="select" @click="showMarket = true" placeholder="选择市场"
						:custom-style="inputStyle" />
				</u-form-item>

				<u-form-item label-width="130rpx">
					<u-input v-model="form.coin" type="select" @click="showcoin = true" placeholder="选择币种"
						:custom-style="inputStyle" />
				</u-form-item>
			</view>

			<view class="form-line">
				<u-form-item label-width="130rpx">
					<u-input v-model="form.initialFund" placeholder="初始资金" :custom-style="inputStyle" />
				</u-form-item>
				<view class="right subsection">
					<u-subsection :list="list" mode="subsection" :current="current" @change="subsectionChange"
						active-color="#ff9900"></u-subsection>
				</view>
			</view>
			<!-- 通用头部 end -->

			<view class="form-line">
				<u-form-item label-width="130rpx">
					<u-input v-model="form.maxPosition" placeholder="首开数量" :custom-style="inputStyle" />
				</u-form-item>
				<u-form-item label-width="130rpx">
					<u-input v-model="form.maxPosition" placeholder="最大补仓" :custom-style="inputStyle" />
				</u-form-item>
			</view>

			<!-- 开仓参数 start只按比例 -->
			<view class="form-line">
				<view>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补1~补3" :custom-style="inputStyle" />
					</u-form-item>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补4~补6" :custom-style="inputStyle" />
					</u-form-item>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补7~最大" :custom-style="inputStyle" />
					</u-form-item>
				</view>
				<view>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补1~补3" :custom-style="inputStyle" />
					</u-form-item>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补4~补6" :custom-style="inputStyle" />
					</u-form-item>
					<u-form-item label-width="130rpx">
						<u-input v-model="form.maxPosition" placeholder="补7~最大" :custom-style="inputStyle" />
					</u-form-item>
				</view>
			</view>
			<!-- 开仓参数 end-->


			<view class="form-line">
				<u-form-item label-width="130rpx">
					<u-input v-model="form.maxPosition" placeholder="平仓利润间距" :custom-style="inputStyle" />
				</u-form-item>
				<!-- <u-form-item label-width="130rpx">

					<u-input v-model="form.closeHoldTime" type="select" @click="showcloseHoldTime = true"
						placeholder="全部平仓再次挂单时间" :custom-style="inputStyle" />
				</u-form-item> -->
			</view>


			<!-- 区间 start -->
			<view class="form-line">
				<u-form-item label-width="130rpx">
					<u-input v-model="form.rangeOn" placeholder="区间上沿" :custom-style="inputStyle" />
				</u-form-item>
				<u-form-item label-width="130rpx">
					<u-input v-model="form.rangeUp" placeholder="区间下沿" :custom-style="inputStyle" />
				</u-form-item>
			</view>
			<!-- 区间 end -->

			<!-- 风险 start-->
			<view class="form-line">
				<view  class="safe">套单释放<u-switch v-model="checked"></u-switch>
				</view>
				<view  class="safe">AI趋势指标<u-switch v-model="checked"></u-switch>
				</view>
			</view>
			<view class="form-line">
				<view  class="safe">追踪止盈<u-switch v-model="checked"></u-switch>
				</view>
				<u-form-item  label-width="130rpx">
					<u-input v-model="form.retracementProportion" :custom-style="inputStyle" placeholder="回撤比例" />
				</u-form-item>
			</view>
			<!-- 风险 end -->


		</u-form>
		<u-action-sheet :list="marketList" v-model="showMarket" @click="marketCallback"></u-action-sheet>
		<u-action-sheet :list="coinList" v-model="showcoin" @click="coinCallback"></u-action-sheet>
		<u-action-sheet :list="closeHoldTimeList" v-model="showcloseHoldTime" @click="closeHoldTimeCallback"></u-action-sheet>
		<view class="u-btn">
			<u-button type="primary" size="large" :ripple="true" shape="circle">创建策略</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 分段器
				list: [{
						name: '做多'
					},
					{
						name: '做空'
					}
				],
				current: 0,
				// INPUT
				inputStyle: {
					color: "aliceblue",
				},
				form: {
					market: '',
					coin: '',
					initialFund: '',
					theFirst: '',
					closeHoldTime: '',
					leverage: '',
					contractType: '',
					openNum: '',
					openSpace: '',
					closeSpace: '',
					rangeOn: '',
					rangeUp: '',
					maxPosition: '',
					// 回撤比例
					retracementProportion: '',
					maxCoverNum: ''
				},
				showMarket: false,
				marketList: [{
					text: 'Huobi交割'
				}, {
					text: 'Huobi永续币本位'
				}],
				showcoin: false,
				coinList: [{
					text: 'BTC'
				}, {
					text: 'ETH'
				}],
				showcloseHoldTime: false,
				closeHoldTimeList: [{
					text: '1'
				}, {
					text: '10'
				}],
				riskControl: [{
						name: '熔断保护',
						checked: true,
						disabled: false
					},
					{
						name: 'AI趋势指标',
						checked: true,
						disabled: false
					},
					{
						name: '追踪止盈',
						checked: true,
						disabled: false
					}
				],
				// 开仓 平仓
				openSetPrice: [{
						name: '按比例'
					},
					{
						name: '按数值'
					},
				],
				openSetNum: [{
						name: '按比例'
					},
					{
						name: '按数值'
					},
				],
				closeSet: [{
						name: '按比例'
					},
					{
						name: '按数值'
					},
				],
				checked: true,
			};
		},

		components: {},

		computed: {},

		mounted() {},

		methods: {
			closeHoldTimeCallback(index) {
				this.form.closeHoldTime = this.closeHoldTimeList[index].text;
			},
			// 选中某个复选框时，由checkbox时触发
			checkboxChange(e) {
				//console.log(e);
			},
			// 选中任一checkbox时，由checkbox-group触发
			checkboxGroupChange(e) {
				console.log(e);
			},
		}
	}
</script>
<style lang='scss' scoped>
	@import '@/styles/quant-form.scss';
</style>
